//
//  MyInterface.m
//  A1.0
//
//  Created by lanou3g on 15-4-7.
//  Copyright (c) 2015年 ccandxx. All rights reserved.
//

#import "MyInterface.h"
#import "jokeModel.h"
#import "picModel.h"
#import "womenModel.h"
#import "videoModel.h"
#import "petModel.h"
#import "DataHandle.h"

@implementation MyInterface

//收藏
+(void)insertWithJoke:(jokeModel *)ajoke
{
    [[DataHandle shareDataBase] openDB];
    [[DataHandle shareDataBase] createJokeTable];
    [[DataHandle shareDataBase] insertJoke:ajoke];
    [[DataHandle shareDataBase] closeDB];
}
+(void)insertWithFunny:(picModel *)afun
{
    [[DataHandle shareDataBase] openDB];
    [[DataHandle shareDataBase] createPicTable];
    [[DataHandle shareDataBase] insertPic:afun];
    [[DataHandle shareDataBase] closeDB];
}
+(void)insertWithWomen:(womenModel *)awomen
{
    [[DataHandle shareDataBase] openDB];
    [[DataHandle shareDataBase] createWomenTable];
    [[DataHandle shareDataBase] insertWomen:awomen];
    [[DataHandle shareDataBase] closeDB];
}
+(void)insertWithVideo:(videoModel *)avideo
{
    [[DataHandle shareDataBase] openDB];
    [[DataHandle shareDataBase] createVideoTable];
    [[DataHandle shareDataBase] insertVideo:avideo];
    [[DataHandle shareDataBase] closeDB];
}
+(void)insertWithPet:(petModel *)apet
{
    [[DataHandle shareDataBase] openDB];
    [[DataHandle shareDataBase] createPetTable];
    [[DataHandle shareDataBase] insertPet:apet];
    [[DataHandle shareDataBase] closeDB];
}



//选中显示
+(NSMutableArray *)selectWithAllJoke
{
    [[DataHandle shareDataBase] openDB];
    
    NSMutableArray *jokeArray = [[DataHandle shareDataBase] selectAllJoke];
    
    [[DataHandle shareDataBase] closeDB];
    
    return jokeArray;
}
+(NSMutableArray *)selectWithAllFunny
{
    [[DataHandle shareDataBase] openDB];
    
    NSMutableArray *funArray = [[DataHandle shareDataBase] selectAllFun];
    
    [[DataHandle shareDataBase] closeDB];
    
    return funArray;
}
+(NSMutableArray *)selectWithAllWomen
{
    [[DataHandle shareDataBase] openDB];
    
    NSMutableArray *womArray = [[DataHandle shareDataBase] selectAllWomen];
    
    [[DataHandle shareDataBase] closeDB];
    
    return womArray;
}
+(NSMutableArray *)selectWithAllVideo
{
    [[DataHandle shareDataBase] openDB];
    
    NSMutableArray *vioArray = [[DataHandle shareDataBase] selectAllVideo];
    
    [[DataHandle shareDataBase] closeDB];
    
    return vioArray;
}
+(NSMutableArray *)selectWithAllPet
{
    [[DataHandle shareDataBase] openDB];
    
    NSMutableArray *petArray = [[DataHandle shareDataBase] selectAllPet];
    
    [[DataHandle shareDataBase] closeDB];
    
    return petArray;
}

//删除
+(void)deleteWithJokeID:(NSInteger)ID
{
    [[DataHandle shareDataBase] openDB];
    [[DataHandle shareDataBase] deleteWithJokeID:ID];
    [[DataHandle shareDataBase] closeDB];
}
+(void)deleteWithFunnyID:(NSInteger)ID
{
    [[DataHandle shareDataBase] openDB];
    [[DataHandle shareDataBase] deleteWithPicID:ID];
    [[DataHandle shareDataBase] closeDB];
}
+(void)deleteWithWomenID:(NSInteger)ID
{
    [[DataHandle shareDataBase] openDB];
    [[DataHandle shareDataBase] deleteWithWomenID:ID];
    [[DataHandle shareDataBase] closeDB];
}
+(void)deleteWithVideoID:(NSInteger)ID
{
    [[DataHandle shareDataBase] openDB];
    [[DataHandle shareDataBase] deleteWithVideoID:ID];
    [[DataHandle shareDataBase] closeDB];
}
+(void)deleteWithPetID:(NSInteger)ID
{
    [[DataHandle shareDataBase] openDB];
    [[DataHandle shareDataBase] deleteWithPetID:ID];
    [[DataHandle shareDataBase] closeDB];
}

@end
